<template>
  <div class="branchBaseData" v-loading="loading" element-loading-text="加载中。。。">
    <!-- <el-card> -->
      <el-row>
        <el-col :span="6">
          <el-card style='overflow:auto;height:824px;' shadow="never">
            <div class="branchStyle">机构树</div>
            <!-- <div class="line1"></div> -->
            <!-- <el-tree :data="treedata" :props="defaultProps" @node-click="handleNodeClick" default-expand-all :expand-on-click-node="false">
            </el-tree> -->
            <select-tree :branch="BRANCHNAME" @getBranchName="getBranch" :my-show='true'></select-tree>
          </el-card>
        </el-col>
        <el-col :span="18">
          <el-card style="margin-left:1px;overflow:auto">
            <div>总行 <span v-show='BRANCHNAME !== "总行"'>/</span><span style="color: #409EFF;margin-left: 5px;">{{BRANCHNAME === "总行"? '': BRANCHNAME}}</span></div>
            <div class="line1"></div>
            
            <el-form :model="ruleForm" :rules="rules" label-position="top" ref="ruleForm" label-width="140px"
              class="demo-ruleForm">
              <el-row :gutter="10">
                <el-col :span="6">
                  <el-form-item label="机构号" prop="id">
                    <el-input size="small" disabled v-model="ruleForm.BRANCHNO"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="机构名称">
                    <el-input size="small" disabled v-model="BRANCHNAME"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="机构人数">
                    <el-input size="small" disabled v-model="ruleForm.AGENTNUM"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
             
              <el-button v-if="canAdd" type="primary" size="small" @click="createBranch" :disabled="!canAdd">立即创建
              </el-button>
              <div v-if="!canAdd">
                <el-row :gutter="10">
                  <el-col :span="6">
                    <el-form-item label="周开始日" prop="WEEKSRTDATE">
                      <el-select v-model="ruleForm.WEEKSRTDATE" size="small" placeholder="请选择周开始日">
                        <el-option v-for="item in optionsAWeeks" :key="item.value" :label="item.label"
                          :value="item.value" size="small">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="月开始日" prop="MONTHSRTDATE">
                      <el-select v-model="ruleForm.MONTHSRTDATE" size="small" placeholder="请选择月开始日">
                        <el-option v-for="item in 31" :key="item" :label="item" :value="item" size="small">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="安排坐席最大人数" prop="MAXAGENTCOUNT">
                      <el-input v-model="ruleForm.MAXAGENTCOUNT" size="small" oninput="value=value.replace(/[^\d]/g,'')"
                        maxlength="6" placeholder="请输入安排坐席最大人数"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="安排坐席最小人数" prop="MINAGENTCOUNT">
                      <el-input v-model="ruleForm.MINAGENTCOUNT" size="small" maxlength="6"
                        oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入安排坐席最小人数"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="日分界" prop="DAYLINE">
                      <el-time-picker v-model="ruleForm.DAYLINE" format="HH:mm" value-format="HH:mm" size="small"
                        @focus="ChangeTime('DAYLINE')" placeholder="请选择日分界">
                      </el-time-picker>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="允许跨日分界的班" prop="ISALLOW2DAYS">
                      <!-- <el-checkbox v-model="ruleForm.ISALLOW2DAYS" size="small" true-label="1" false-label="0">
                      </el-checkbox> -->
                      <el-radio v-model="ruleForm.ISALLOW2DAYS" label="0">不允许</el-radio>
                      <el-radio v-model="ruleForm.ISALLOW2DAYS" label="1">允许</el-radio>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <div class="newDate">
                  <el-col :span="6">
                    <el-form-item label="法定假日运营时间表" prop="" class="my-form">
                      <el-col :span="10">
                        <el-time-picker is-range size="small" v-model="ruleForm.HOLIDAYTABLE" range-separator="-"
                          format="HH:mm" value-format="HH:mm" @focus="ChangeTime('HOLIDAYTABLE')"
                          start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                    </el-form-item>
                  </el-col>
                  </div>
                  <el-col :span="12">
                    <el-form-item label="是否7*24小时机构" prop="IS724BRANCH" class="my-form1">
                      <!-- <el-checkbox v-model="ruleForm.IS724BRANCH" size="small" true-label="1" false-label="0">
                      </el-checkbox> -->
                      <el-radio v-model="ruleForm.IS724BRANCH" label="1">是</el-radio>
                      <el-radio v-model="ruleForm.IS724BRANCH" label="0">否</el-radio>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <div class="newDate"> 
                  <el-col :span="6">
                    <el-form-item label="星期一" prop="" class="my-form">
                      <el-col :span="10">
                        <el-time-picker width="100%" :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[1]" range-separator="-" format="HH:mm" value-format="HH:mm"
                          @focus="ChangeTime('WORKTIMETABLE',1)" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期二" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[2].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[2]" @focus="ChangeTime('WORKTIMETABLE',2)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[2].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期三" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[3].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[3]" @focus="ChangeTime('WORKTIMETABLE',3)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[3].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期四" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[4].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[4]" @focus="ChangeTime('WORKTIMETABLE',4)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[4].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期五" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[5].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[5]" @focus="ChangeTime('WORKTIMETABLE',5)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[5].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期六" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[6].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[6]" @focus="ChangeTime('WORKTIMETABLE',6)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[6].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="星期日" prop="" class="my-form">
                      <el-col :span="10">
                        <!-- <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[7].start"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker> -->
                        <el-time-picker :disabled="ruleForm.IS724BRANCH=='1'" is-range size="small"
                          v-model="ruleForm.WORKTIMETABLE[7]" @focus="ChangeTime('WORKTIMETABLE',7)" range-separator="-"
                          format="HH:mm" value-format="HH:mm" start-placeholder="开始时间" end-placeholder="结束时间"
                          placeholder="选择时间范围">
                        </el-time-picker>
                      </el-col>
                      <!-- <el-col class="line" :span="2">-</el-col>
                    <el-col :span="10">
                      <el-time-picker size="small"
                        v-model="ruleForm.WORKTIMETABLE[7].end"
                        format="HH:mm"
                        value-format="HH:mm"
                        style="width: 100%"
                        :disabled="ruleForm.IS724BRANCH=='1'">
                      </el-time-picker>
                    </el-col> -->
                    </el-form-item>
                  </el-col>
                </div>

                </el-row>

                <el-row style="text-align: left;">
                  <el-col>
                    <el-form-item>
                      <el-button type="warning" size="small">返回</el-button>
                      <el-button type="primary" size="small" @click="submitForm('ruleForm','save')">确定</el-button>
                      <!-- <el-button size="small" @click="resetForm('ruleForm')">重置</el-button> -->
                    </el-form-item>
                  </el-col>
                </el-row>
              </div>
            </el-form>
          </el-card>
        </el-col>
      </el-row>
    <!-- </el-card> -->
  </div>
</template>

<script>
  import request from "@/common/utils/requestWFM";
  import selectTree from "@/components/selectTree5/";
  import branchQuery from '@/message/wfm/scheduleDataManage/branchData/branchDataQuery';
  import branchDataEdit from '@/message/wfm/scheduleDataManage/branchData/branchDataEdit';
  // import Query from '@/message/wfm/baseData/branchManage/branchQuery';
  export default {
    components: {
      selectTree
    },
    computed: {

    },
    watch: {
      'ruleForm.IS724BRANCH': function (val) {
        if (val === '1') {
          this.ruleForm.WORKTIMETABLE = {
            "1": ['00:00', '00:00'],
            "2": ['00:00', '00:00'],
            "3": ['00:00', '00:00'],
            "4": ['00:00', '00:00'],
            "5": ['00:00', '00:00'],
            "6": ['00:00', '00:00'],
            "7": ['00:00', '00:00'],
          };
        }
      },
    },
    data() {
      return {
        activeNames: ['1', '2'],
        // 机构
        branchNO: this.$store.getters.BranchNum,
        defaultProps: {
          children: 'children',
          label: 'BRANCHNAME'
        },
        resData: "",
        treedata: [],
        loading: false,
        BRANCHNAME: this.$store.getters.BranchName,
        ruleForm: {
          BRANCHNO: this.$store.getters.BranchNum,
          WEEKSRTDATE: '', //周开始日
          MONTHSRTDATE: '', //月开始日
          IS724BRANCH: '0', //是否7*24小时机构
          //机构运营时间表
          WORKTIMETABLE: {
            "1": ['00:00', '00:00'],
            "2": ['00:00', '00:00'],
            "3": ['00:00', '00:00'],
            "4": ['00:00', '00:00'],
            "5": ['00:00', '00:00'],
            "6": ['00:00', '00:00'],
            "7": ['00:00', '00:00'],
          },
          HOLIDAYTABLE: ['00:00', '00:00'], //法定假日运营时间表
          MAXAGENTCOUNT: '0', //最大坐席数量
          ISALLOW2DAYS: '0', //是否允许跨日分界的班次分配
          HOLIDAYPOOLID: '', //休假池编号
          MEDIATYPE: '', //支持的媒体类型
          DAYLINE: '', //日分界
          MINAGENTCOUNT: '0', //安排坐席最小人数
          AGENTNUM: 0, //机构人数
        },
        ruleFormBackUp: {}, //初始数据备份
        rules: {
          WEEKSRTDATE: [{
            required: true,
            message: '请选择周开始日',
            trigger: 'change'
          }],
          MONTHSRTDATE: [{
            required: true,
            message: '请选择月开始日',
            trigger: 'change'
          }],
          MAXAGENTCOUNT: [{
              required: true,
              message: '请输入最大坐席数量',
              trigger: 'blur'
            },
            {
              min: 1,
              max: 6,
              message: '长度在 1 到 6 个数字',
              trigger: 'blur'
            }
          ],
          MINAGENTCOUNT: [{
              required: true,
              message: '请输入安排坐席最小人数',
              trigger: 'blur'
            },
            {
              min: 1,
              max: 6,
              message: '长度在 1 到 6 个数字',
              trigger: 'blur'
            }
          ],
          DAYLINE: [{
            required: true,
            message: '请选择日分界',
            trigger: 'blur'
          }],
          ISALLOW2DAYS: [{
            required: true,
            message: '请选择允许跨日分界的班',
            trigger: 'change'
          }],
        },
        optionsAWeeks: [{
          value: '1',
          label: '星期一'
        }, {
          value: '2',
          label: '星期二'
        }, {
          value: '3',
          label: '星期三'
        }, {
          value: '4',
          label: '星期四'
        }, {
          value: '5',
          label: '星期五'
        }, {
          value: '6',
          label: '星期六'
        }, {
          value: '7',
          label: '星期日'
        }],
        //是否可以新建
        canAdd: true,
      }
    },
    mounted() {
      this.querytype();
      // this.queryBranch() //机构查询
    },
    methods: {
      getBranch(data) {
        this.BRANCHNAME = data.BRANCHNAME
        this.ruleForm.BRANCHNO = data.BRANCHNO;
        if (this.$refs['ruleForm'] != undefined) {
          this.$refs['ruleForm'].clearValidate();
          this.$refs['ruleForm'].resetFields();
        }
        this.querytype();
      },
      ChangeTime(data, index) {
        var tiem = '00:00';
        var that = this;
        if (data == 'DAYLINE') {
          if (this.ruleForm.DAYLINE == null || this.ruleForm.DAYLINE == '') {
            this.ruleForm.DAYLINE = tiem;
          }
        } else if (data == 'HOLIDAYTABLE') {
          if (this.ruleForm.HOLIDAYTABLE == null || this.ruleForm.HOLIDAYTABLE == '') {
            this.ruleForm.HOLIDAYTABLE = [tiem, tiem];
          }
        } else if (data == 'WORKTIMETABLE') {
          if (this.ruleForm.WORKTIMETABLE[index] === null) {
            this.ruleForm.WORKTIMETABLE[index] = [tiem, tiem];
          } else if (this.ruleForm.WORKTIMETABLE[index][0] == '' && this.ruleForm.WORKTIMETABLE[index][1] == '') {
            this.ruleForm.WORKTIMETABLE[index] = [tiem, tiem];
          }
        }
      },
      createBranch() {
        this.canAdd = false
        this.ruleForm.WEEKSRTDATE = '' //周开始日
        this.ruleForm.MONTHSRTDATE = '' //月开始日
        this.ruleForm.IS724BRANCH = '0' //是否7*24小时机构
        this.ruleForm.MAXAGENTCOUNT = '0'
        this.ruleForm.HOLIDAYTABLE = ['00:00', '00:00']
        this.ruleForm.ISALLOW2DAYS = '0'
        this.ruleForm.HOLIDAYPOOLID = '' //休假池编号
        this.ruleForm.MEDIATYPE = '' //支持的媒体类型
        this.ruleForm.DAYLINE = '' //日分界
        this.ruleForm.MINAGENTCOUNT = '0' //安排坐席最小人数
      },
      // 保存
      submitForm(formName, operation) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.editBranchData();
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        if (this.canAdd) {
          this.$refs[formName].resetFields();
          this.$refs[formName].clearValidate();
        } else {
          // 不是新增则把值重置成原来的
          this.ruleForm = JSON.parse(JSON.stringify(this.ruleFormBackUp));
        }
      },
      // 查询机构排班参数
      async querytype() {
        this.loading = true;
        let resBody = new branchQuery();
        resBody.data.BRANCHNO = this.ruleForm.BRANCHNO;
        let response = await request(resBody);
        if (response.SYS_HEAD.ReturnCode == "000000") {
          // 查询出数据
          if (response.BODY.RSPSTRUCT.length > 0) {
            this.canAdd = false;
            this.ruleForm = response.BODY.RSPSTRUCT[0];
            var HOLIDAYTABLE = this.timeSplit(this.ruleForm.HOLIDAYTABLE);
            var WORKTIMETABLE = {};
            this.ruleForm.HOLIDAYTABLE = HOLIDAYTABLE;
            if (this.ruleForm.IS724BRANCH == '1' || this.ruleForm.WORKTIMETABLE == '') {
              this.ruleForm.WORKTIMETABLE = {
                "1": ['00:00', '00:00'],
                "2": ['00:00', '00:00'],
                "3": ['00:00', '00:00'],
                "4": ['00:00', '00:00'],
                "5": ['00:00', '00:00'],
                "6": ['00:00', '00:00'],
                "7": ['00:00', '00:00'],
              };
            } else {
              this.ruleForm.WORKTIMETABLE = JSON.parse(this.ruleForm.WORKTIMETABLE);
              for (var i = 1; i <= 7; i++) {
                WORKTIMETABLE[i] = this.timeSplit(this.ruleForm.WORKTIMETABLE[i]);
              }
              this.ruleForm.WORKTIMETABLE = WORKTIMETABLE;
            }
            this.ruleFormBackUp = JSON.parse(JSON.stringify(this.ruleForm));
          } else {
            this.canAdd = true;
            this.ruleForm.AGENTNUM = 0;
          }
        } else {
          this.ruleForm.AGENTNUM = 0;
          this.canAdd = true;
          this.$message({
            type: "error",
            message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
          });
        }
        this.loading = false;
      },
      // 修改
      async editBranchData() {
        var WORKTIMETABLE = {};
        var that = this;
        var flag = '';
        $.each(this.ruleForm.WORKTIMETABLE, function (key, val) {
          if (val !== null && val[0] !== '' && val[1] !== '') {
            var obj = {};
            if (key === "1") {
              obj = {
                "1": val[0] + "-" + val[1]
              };
            } else if (key === "2") {
              obj = {
                "2": val[0] + "-" + val[1]
              };
            } else if (key === "3") {
              obj = {
                "3": val[0] + "-" + val[1]
              };
            } else if (key === "4") {
              obj = {
                "4": val[0] + "-" + val[1]
              };
            } else if (key === "5") {
              obj = {
                "5": val[0] + "-" + val[1]
              };
            } else if (key === "6") {
              obj = {
                "6": val[0] + "-" + val[1]
              };
            } else if (key === "7") {
              obj = {
                "7": val[0] + "-" + val[1]
              };
            }
            Object.assign(WORKTIMETABLE, obj)
          } else {
            flag += '星期' + key + ' ';
          }
        })
        if (flag !== '') {
          this.$message({
            type: "error",
            message: `请选择 ${flag}时间`
          });
          return;
        }
        this.loading = true;
        let resBody = new branchDataEdit();
        resBody.data.BRANCHNO = this.ruleForm.BRANCHNO;
        resBody.data.WEEKSRTDATE = this.ruleForm.WEEKSRTDATE;
        resBody.data.MONTHSRTDATE = this.ruleForm.MONTHSRTDATE;
        resBody.data.IS724BRANCH = this.ruleForm.IS724BRANCH;
        resBody.data.WORKTIMETABLE = JSON.stringify(WORKTIMETABLE);
        resBody.data.HOLIDAYTABLE = this.ruleForm.HOLIDAYTABLE !== null ? this.ruleForm.HOLIDAYTABLE[0] + '-' + this
          .ruleForm.HOLIDAYTABLE[1] : '00:00-00:00';
        resBody.data.MAXAGENTCOUNT = this.ruleForm.MAXAGENTCOUNT;
        resBody.data.ISALLOW2DAYS = this.ruleForm.ISALLOW2DAYS;
        resBody.data.HOLIDAYPOOLID = this.ruleForm.HOLIDAYPOOLID;
        resBody.data.MEDIATYPE = this.ruleForm.MEDIATYPE;
        resBody.data.DAYLINE = this.ruleForm.DAYLINE;
        resBody.data.MINAGENTCOUNT = this.ruleForm.MINAGENTCOUNT;
        let response = await request(resBody);
        if (response.SYS_HEAD.ReturnCode == "000000") {
          this.canAdd = false;
          this.querytype();
          this.$message({
            type: "success",
            message: "保存成功"
          });
        } else {
          this.$message({
            type: "error",
            message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
          });
        }
        this.loading = false;
      },
      // 时间切割成开始,结束格式
      timeSplit(time) {
        var str = '';
        var obj = [];
        if (time) {
          str = time.split('-');
          obj[0] = str[0] == "null" ? '00:00' : str[0];
          obj[1] = str[1] == "null" ? '00:00' : str[1];
        } else {
          obj = ['00:00', '00:00'];
        }
        return obj;
      }
    }
  };

</script>

<style lang="scss" scoped>
  .branchStyle {
    margin-bottom: 20px;
  }

  .line1 {
    width: 100%;
    margin: 14px 0;
    border: 0.5px solid rgb(220, 223, 230);
    text-align: center;
  }

  .branchBaseData {

    .my-form,
    .my-form1 {
      .el-col-10 {
        padding: 0px !important;
      }
    }

    .el-input,
    .el-select {
      width: 90%;
    }

    .my-form {
      display: inline-block;

      .el-input {
        width: 100px;
      }

      .line {
        text-align: center;
      }
    }
    .newDate .el-date-editor--timerange.el-input__inner{
      width: 216%;
    }
  }

</style>
